Summary Vignette

Interaction Data Summary Statistics

library(dplyr)
Warning: package 'dplyr' was built under R version 4.5.2
df <- read.csv(here::here("../Avian-Interaction-Database-Working/L1/ain_cac.csv"))
spp <- read.csv(here::here("./data/L1/species_checklists/spp_joint_cac_colsubset.csv"))

num_intxns <- nrow(df)

unique_intxns <- df %>% 
  dplyr::select(species1_scientific, 
                species2_scientific, 
                effect_sp1_on_sp2, 
                effect_sp2_on_sp1, 
                interaction) %>% 
  filter(!duplicated(.)) 

num_unique_intxns <- nrow(unique_intxns)

num_focal_spp <- length(unique(df$species1_scientific))

unique_spp_list <- unique(c(df$species1_scientific, df$species2_scientific))
num_total_spp <- length(unique_spp_list)

num_new_spp2 <- length(setdiff(unique_spp_list, df$species1_scientific))

unique_spp_list_names <- unique(spp$scientific_name_clements2024)
unique_spp1_ain_names <- unique(df$species1_scientific)
  • Number of documented pairwise interactions: 25958
  • Number of unique pairwise interactions: 20913
  • Number of focal species: 923
  • Number of additional non-focal spp: 1199
  • Number of species (total): 2122
  • Percent of world’s bird spp (out of 11,1145 spp): 19.04
  • Total number of migratory species: [Not sure how to calculate this]
  • Total number of interaction types: 25

Species list summary

  • Total number of species in the North American Avian Interaction Species List: 777
unique_intxns %>% group_by(interaction) %>% summarize(n=n()) %>% arrange(-n)
# A tibble: 25 × 2
   interaction                     n
   <chr>                       <int>
 1 predation                    5401
 2 competition                  3132
 3 co-occur                     2203
 4 brood parasitism             1523
 5 facilitation                 1450
 6 commensalism                 1095
 7 mobbing                       940
 8 communal nesting              920
 9 communal roosting             721
10 facilitation-mixed flocking   714
# ℹ 15 more rows

Interaction Data Exploratory Figures

Source _figure_processing.R which contains the data processing and plotting functions. See 5.5_figure_processing_vignette.qmd for further explanation of the data processing and plot functions!

source(here::here("../Avian-Interaction-Database/R/L2/_figure_processing.R"))

Interaction Distribution Figure

ggplot(type_summ, aes(x = interaction, y = n, fill = interaction)) +
    theme_light() +
    geom_bar(stat = "identity") +
    scale_fill_manual(values = setNames(interaction_categories$color,
                                        interaction_categories$interaction)) +
    geom_text(aes(label = n), hjust = -0.2, size = 4.25) +
    theme(axis.text.x = element_text(angle = 0, size = 14),  
          axis.text.y = element_text(size = 14),             
          axis.title = element_text(size = 16),              
          plot.title = element_text(size = 18),              
          legend.position = "none") +
    xlab("") +
    ylab("") +
    labs(title = "Total Interactions Records(by entry) in North America") +
    coord_flip()

ggplot(type_summ_slim, aes(x = interaction, y = n, fill = interaction)) +
    theme_light() +
    geom_bar(stat = "identity") +
    scale_fill_manual(values = setNames(interaction_categories$color,
                                        interaction_categories$interaction)) +
    geom_text(aes(label = n), hjust = -0.2, size = 4.25) +
    theme(axis.text.x = element_text(angle = 0, size = 14),  
          axis.text.y = element_text(size = 14),             
          axis.title = element_text(size = 16),              
          plot.title = element_text(size = 18),              
          legend.position = "none") +
    xlab("") +
    ylab("") +
    labs(title = "Total Interaction Records (by unique species and type) in North America") +
    coord_flip()

Interaction Phylogeny Figure

phyloplot_species <- plot_phylo_combined(
  tree = NA_tree,
  data = inter_NA_working,
  value_col = "n_int",
  label_offset = 8,
  label_size = 4.5,
  tip_size = 2,
  min_species = 25,
  legend_title = "Number of interactions"
)
phyloplot_species

Interaction Network Figure

create_network(inter_NA_int, "Baeolophus inornatus", curve_edges = T, show_labels = F)

create_combined_network(inter_NA_int, c("Baeolophus inornatus", "Dryobates nuttallii", "Glaucidium gnoma"), curve_edges = T)
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.